function initEcharts(target, eId, title,series) {
    target.eChart = echarts.init(eId);
  //  console.log(this.series);
    target.eChart.setOption({
        // backgroundColor: "#eee",
        legend: {
            data: target.data.category,
            // left: 0,
            orient: 'vertical',
            type: "scroll",
            selected: target.data.selected,
            left: 'auto',
            padding: [0, 50, 0, 0]
            // align:'left'
        },
        // brush: {
        //     toolbox: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'],
        //     xAxisIndex: 0
        // },
        toolbox: {
            feature: {
                mark: {show: true},
                dataView: {show: true, readOnly: false},
                magicType: {
                    type: ['stack', 'tiled', 'line', 'bar'],
                },
                restore: {show: true},
                saveAsImage: {show: true}
            }
        },
        tooltip: {
            show: true,
            trigger: "axis"
            // trigger:"line"
        },
        title: {
            text: title,
            left: '300',
            textStyle: {
                color: "#777",
                fontSize: 16
            }
        },
        xAxis: {
            data: target.data.xAxis,
            name: 'X Axis',
            axisLine: {onZero: true},
            splitLine: {show: false},
        },
        yAxis: {
            splitLine: {show: false},
            // inverse: true
        },
        grid: {
            left: 100
        },
        series: series(target)
    });
}


function quickSort(tmp, nums, lo, hi) {
    if (lo >= hi) {
        return;
    }

    function partion(nums, lo, hi) {
        let i = lo, j = hi + 1;
        let num = tmp["2021"][nums[lo]] === undefined ? 0 : tmp["2021"][nums[lo]];
        while (true) {
            while (i !== hi && (tmp["2021"][nums[++i]] === undefined ? 0 : tmp["2021"][nums[i]]) > num) {
            }
            while (j !== lo && (tmp["2021"][nums[--j]] === undefined ? 0 : tmp["2021"][nums[j]]) < num) {
            }
            if (i >= j) {
                break;
            }
            swap(nums, i, j);
        }

        function swap(nums, j, lo) {
            let s = nums[j];
            nums[j] = nums[lo];
            nums[lo] = s;
        }

        swap(nums, j, lo);
        return j;
    }

    let par = partion(nums, lo, hi);
    this.quickSort(tmp, nums, lo, par - 1);
    this.quickSort(tmp, nums, par + 1, hi);

}

function reqXXX(target) {
    return new Promise((resolve, reject) => {
        let req = new XMLHttpRequest();
        req.open("GET", target);
        req.send();
        let self = this;
        req.onreadystatechange = function (e) {
            if (req.status === 200 && req.readyState === 4) {
                resolve(e);
            }
        }
    });
}